package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:字符串去重
 * User: LianBao
 * Date: 2024-03-16
 * Time: 14:48
 */
public class Test2 {

    public static String Func(String str) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (sb.indexOf(ch + "") == -1) {
                sb.append(ch);
            }
        }

        return sb.toString();
    }

    public static void main(String[] args) {
        String str = "aBcaBc";
        System.out.println(Func(str));
    }

}
